package logic

import (
	"context"
	"yuekaoHouse/house_srv/model/redis"

	"yuekaoHouse/house_srv/house"
	"yuekaoHouse/house_srv/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type GetSmsCodeLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewGetSmsCodeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetSmsCodeLogic {
	return &GetSmsCodeLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *GetSmsCodeLogic) GetSmsCode(in *house.GetSmsCodeRequest) (*house.GetSmsCodeResponse, error) {
	// todo: 获取短信验证码

	code := redis.RedisGetSmsCode(in.Mobile, in.Sale)

	return &house.GetSmsCodeResponse{Code: code}, nil
}
